package com.woniuxy.config;

import com.woniuxy.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Resource
    private LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)//自己的拦截器
                .addPathPatterns("/**")//拦截规则
                .excludePathPatterns("/user/login","/**")//免拦截路劲
                .order(1);//执行顺序
    }
}
